package com.srs.backend.controller;

import com.srs.backend.service.OrderItemService;
import com.srs.backend.utils.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/api/order/item")
public class OrderItemController {
    @Resource
    private OrderItemService orderItemService;

    @PostMapping("/add/")
    public Result add(@RequestBody Map<String, String> data) {
        return orderItemService.add(data);
    }

    @PostMapping("/delete/")
    public Result delete(@RequestBody Map<String, String> data) {
        return orderItemService.delete(data);
    }

    @PostMapping("/modify/")
    public Result modify(@RequestBody Map<String, String> data) {
        return orderItemService.modify(data);
    }

    @PostMapping("/get/all/")
    public Result getAll() {
        return orderItemService.getAll();
    }

    @PostMapping("/done/")
    public Result done(@RequestBody Map<String, String> data) {
        return orderItemService.done(data);
    }
    @PostMapping("/get/order/item/by/order/id/")
    public Result getOrderItemByOrderId(@RequestBody Map<String, String> data) {
        return orderItemService.getOrderItemByOrderId(data);
    }
    @PostMapping("/get/all/unfinished/")
    public Result getAllUnfinishedOrderItem() {
        return orderItemService.getAllUnfinishedOrderItem();
    }
    @PostMapping("/get/all/finished/by/chef/id/")
    public Result getAllFinishedByChefId(@RequestBody Map<String, String> data) {
        return orderItemService.getAllFinishedByChefId(data);
    }
}
